Skip to content

[6.x] Fix errors when a structure tree contains a null item#14941

Open
mynetx wants to merge 1 commit into
statamic:6.xfrom
mynetx:fix/structure-null-item-order
Open

[6.x] Fix errors when a structure tree contains a null item#14941
mynetx wants to merge 1 commit into
statamic:6.xfrom
mynetx:fix/structure-null-item-order

Conversation

@mynetx

@mynetx mynetx commented Jul 4, 2026

Copy link
Copy Markdown
Contributor

When a structure tree somehow ends up with a null item (e.g. [{entry: ...}, null] in the yaml — the reporter isn't sure how it got there), reading an entry's order() — including through augmentation — blows up with array_flip(): Can only flip string and integer values, and saving the tree crashes the diff with an undefined array key error.

This removes null items (including nested ones under children) when the tree is set, so trees hydrated from disk, set programmatically, or saved through the CP are always clean — and the next save writes a healed file.

Supersedes #14802, which was closed for targeting 5.x.

Fixes #14801

A null item in a tree (e.g. a corrupted yaml file) would crash
Entry::order() and augmentation via array_flip(), and crash the
tree diff when saving.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Invalid structure item breaks entry augmentation

1 participant